package xyz.thoughtset.viewer.modules.step.entity;

import cn.zhxu.bs.bean.DbIgnore;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import xyz.thoughtset.viewer.common.core.entity.BaseMeta;
import xyz.thoughtset.viewer.common.crud.core.annotation.ApiCRUDPower;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Objects;

@TableName
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiCRUDPower(insert = false,save = true,update = false,list = true)
public class QueryBlock extends BaseMeta {
    protected String bodyId;
    protected String cacheId;
//    private String blockType;
//    private Boolean loop;
    protected Boolean single;

    @TableField(exist = false)
    @DbIgnore
    private List<BlockParam> paramMappings;

    public boolean resultWasSingle() {
        return Objects.nonNull(single) && single.booleanValue();
    }

}
